var t = getApp();

Page({
    data: {
        show: !0,
        server: t.server,
        serverUrl: t.serverUrl,
        list: []
    },
    collapse: function(t) {
        var e = t.currentTarget.dataset.index, r = {};
        r["list[" + e + "].show"] = !this.data.list[e].show, this.setData(r);
    },
    onLoad: function(t) {
        this.reload();
    },
    reload: function() {
        var e = this, r = wx.getStorageSync("usr");
        this.setData({
            usr: r
        }), t.request({
            url: t.server + "/orderApi/getOrderList",
            method: "POST",
            data: {
                token: t.token,
                userToken: this.data.usr.userToken
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function(t) {
                0 !== t.data.code && wx.showToast({
                    title: t.data.msg.zh,
                    icon: "none"
                });
                var r = !0, o = !1, n = void 0;
                try {
                    for (var a, s = t.data.result.orders[Symbol.iterator](); !(r = (a = s.next()).done); r = !0) {
                        var i = a.value;
                        i.show = !1, i.createtime = i.createtime.substring(0, 10);
                    }
                } catch (t) {
                    o = !0, n = t;
                } finally {
                    try {
                        !r && s.return && s.return();
                    } finally {
                        if (o) throw n;
                    }
                }
                e.setData({
                    list: t.data.result.orders
                });
            }
        }), t.request({
            url: t.server + "/userApi/getFactoryInfo",
            method: "POST",
            data: {
                token: t.token
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function(t) {
                e.setData({
                    vendor: t.data.result.info
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});